package com.aaa.controller;

import com.aaa.util.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
public class TestController {

    @GetMapping("test")

    @PreAuthorize("hasRole('ADMIN')")
    public String aaa(){
     return "aaaa";
    }

    @GetMapping("user")
    public Result user(Principal principal){
        return Result.success(principal);
    }

}
